package com.briup.day14;

public class Test_Week {
    public static void main(String[] args) {
        Week3 w1=Week3.MON;
        w1.show();
        Week3 w2=Week3.TUE;
        w2.show();
        Week3 w3=Week3.WED;
        w3.show();
    }
    public static void main02(String[] args) {
        Week2 w1= Week2.MON;
        Week2 w2= Week2.TUE;
        Week2 w3= Week2.WED;
        System.out.println(w1.getDesc());//null
        System.out.println(w2.getDesc());
        System.out.println(w3.getDesc());
        System.out.println("-----------------------");
        w1.setDesc("周一");
        System.out.println(w1.getDesc());//周一
        System.out.println(w1);//MON
    }
    public static void main01(String[] args) {
        Week week=Week.MON;
        Week week1=Week.TUE;
        Week week2=Week.WED;
        System.out.println(week1);
        System.out.println(week2.toString());
        System.out.println(week.name());
        System.out.println(week.ordinal());
        System.out.println(week1.ordinal());
        System.out.println(week2.ordinal());

    }
}
enum Week{
    MON,TUE,WED;
}
//数据成员和方法 构造方法
//枚举元素必须是第一行有效代码
enum Week2{
    MON,TUE(),WED("周三");
    private String desc;
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }

    Week2(String desc) {
        this.desc = desc;
        System.out.println("Weak(desc)....");
    }
//默认修饰符是private
    Week2() {
        System.out.println("Weak()....");
    }
}
enum Week3{
    MON(){
        @Override
        public void show() {
            System.out.println("周一");
        }
    },TUE(){
        @Override
        public void show() {
            System.out.println("周二");
        }
    },WED(){
        @Override
        public void show() {
            System.out.println("周三");
        }
    };
    private String desc;
    public String getDesc() {
        return desc;
    }
public abstract void show();
    Week3() {
    }

    Week3(String desc) {
        this.desc = desc;
    }
}